/*
 * Copyright (C) 2012 VinaVAC. All rights reserved.
 */
package org.vinavac.mob.mbean;

import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import org.vinavac.bean.AbstractSessionBean;
import org.vinavac.bean.StaffSessionBean;
import org.vinavac.entity.Staff;

/**
 *
 * @author Quang <quangtin3@gmail.com>
 */
@ManagedBean(name = "staffMobileBean")
@SessionScoped
public class StaffMobileBean extends AbstractMobileBean<Staff> {

    private final static String DEFAULT_LOCALE = "en";
    @EJB
    private StaffSessionBean ejbSessionBean;

    public StaffMobileBean() {
        super();
    }

    @Override
    protected Staff emptyEntity() {
        return new Staff();
    }

    @Override
    protected AbstractSessionBean<Staff> getSessionBean() {
        return ejbSessionBean;
    }

    /**
     * Get customized locale for each staff
     *
     * @return staff locale
     */
    public String getLocale() {
        Staff staff = ((StaffSessionBean) getSessionBean()).getStaff();
        return (staff == null) ? DEFAULT_LOCALE : staff.getLanguage();
    }
}
